<template>
  <div>
    <base-list ref="baselist"
               :condition="condition"
               :datas.sync="data"
               :pageSearch="pageSearch">
      <el-row slot="search"
              class="title-header">
        <h4>接运记录</h4>
      </el-row>
      <el-form :inline="true"
               :model="condition"
               class="search-form"
               slot="search"
               ref="aList"
               label-width="100px">
        <el-row>
          <el-col :span="8"
                  class="search-width6">
            <el-form-item label="到达预报号">
              <el-input v-model="condition['search_LIKE_inStorageEntrustNo']"
                        placeholder=""></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8"
                  class="search-width6">
            <el-form-item label="车船号">
              <el-input v-model="condition['search_LIKE_transhipNo']"
                        placeholder=""></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8"
                  class="search-width6">
            <el-form-item label="内转车号">
              <el-input v-model="condition['search_EQ_carNo']"
                        placeholder=""></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8"
                  class="search-width6">
            <el-form-item label="运输方式">
              <el-select v-model="condition['search_EQ_transportWay']"
                         placeholder="请选择"
                         clearable
                         filterable>
                <el-option v-for="[key, val] in _dictTransportModeType"
                           :key="key"
                           :label="val"
                           :value="key"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5"
                  class="search-width6">
            <el-form-item label="品名">
              <el-select v-model="condition['search_EQ_cargoCode']"
                         placeholder="请选择"
                         clearable
                         filterable>
                <el-option v-for="item in cargoNameList"
                           :key="item.cargoCode"
                           :label="item.cargoName"
                           :value="item.cargoCode"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5"
                  class="search-width6">
            <el-form-item label="材质">
              <auto-search-dic v-model="condition['search_EQ_material']"
                               @selectName="v=>condition['search_EQ_material']=v"
                               code="CARGO_CZ"></auto-search-dic>
            </el-form-item>
          </el-col>
          <el-col :span="5"
                  class="search-width6">
            <el-form-item label="生产厂家"
                          clearable>
              <auto-search-dic v-model="condition['search_EQ_madeBy']"
                               @selectName="v=>condition['search_EQ_madeBy']=v"
                               code="CARGO_SCZ"></auto-search-dic>
            </el-form-item>
          </el-col>
          <el-col :span="5"
                  class="search-width8">
            <el-form-item label="规格"
                          class="gg-input">
              <el-col :span="8">
                <auto-search-dic style="width: 100px;"
                                 @selectName="v=>condition['search_EQ_normOne']=v"
                                 code="CARGO_GGY"></auto-search-dic>
              </el-col>
              <el-col :span="8">
                <auto-search-dic style="width: 100px;"
                                 @selectName="v=>condition['search_EQ_normTwo']=v"
                                 code="CARGO_GGE"></auto-search-dic>
              </el-col>
              <el-col :span="8">
                <auto-search-dic style="width: 100px;"
                                 @selectName="v=>condition['search_EQ_normThree']=v"
                                 code="CARGO_GGS"></auto-search-dic>
              </el-col>
            </el-form-item>
          </el-col>
          <el-col :span="9"
                  class="search-width8">
            <el-form-item label="接运时间"
                          class="label-width">
              <el-date-picker style="width:150px;"
                              v-model="condition['search_GTE_checkAcceptTime']"
                              type="date"
                              placeholder="选择日期"
                              value-format="yyyy-MM-dd 00:00:00"> </el-date-picker> 至
              <el-date-picker style="width:150px;"
                              v-model="condition['search_LTE_checkAcceptTime']"
                              type="date"
                              placeholder="选择日期"
                              value-format="yyyy-MM-dd 23:59:59"> </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-button type="primary"
                       icon="el-icon-search"
                       class="ml-100"
                       @click="loadData">查 询</el-button>
            <el-button formVisible="true"
                       icon="el-icon-refresh"
                       @click="resuleBtn('aList')">
              重置
            </el-button>
          </el-col>
        </el-row>
      </el-form>
      <el-table slot="list"
                :data="data"
                border
                stripe
                max-height="550">
        <el-table-column type="index"
                         label="序号"
                         width="50"
                         align="center"></el-table-column>
        <el-table-column prop="entrustNo"
                         label="到达预报号"
                         min-width="120"></el-table-column>
        <el-table-column prop="transhipNo"
                         label="车船号"
                         min-width="120"></el-table-column>
        <el-table-column prop="carNo"
                         label="内转车号"
                         min-width="120"></el-table-column>
        <el-table-column prop="transportWay"
                         label="运输方式"
                         min-width="100">
          <template slot-scope="scope">
            {{ scope.row.transportWay | _filterTransportModeType}}
          </template>
        </el-table-column>
        <el-table-column prop="cargoName"
                         label="品名"
                         min-width="100"></el-table-column>
        <el-table-column prop="material"
                         label="材质"
                         min-width="120"></el-table-column>
        <el-table-column prop="normStr"
                         label="规格"
                         min-width="100"></el-table-column>
        <el-table-column prop="madeBy"
                         label="生产厂家"
                         min-width="120"></el-table-column>
        <el-table-column prop="carryTime"
                         label="接运完成时间"
                         min-width="180"></el-table-column>
        <el-table-column prop="carryNum"
                         label="接运件数"
                         min-width="180"></el-table-column>
        <el-table-column prop="carryWeight"
                         label="接运重量"
                         min-width="180"></el-table-column>
      </el-table>
    </base-list>
    <div class="back">
      <el-button plain
                 type="info"
                 @click="handleRouterPush({path:'/goods/accept',name:'接发管理工作台'})">返回</el-button>
    </div>
  </div>
</template>

<script>
import { getEnumList } from '@/api/enter/arrivalForecast' //入库下拉菜单
import { getCargoNameList } from '@/api/things/accountPageList'//品名
import { receiveRecord } from '@/api/accept/accept' //接运记录列表
import autoSearchDic from '@/components/autocomplete/autoSearchDic'


export default {
  name: 'carry',
  components: {
    autoSearchDic
  },
  data() {
    return {
      form: this.clearForm(),
      pageSearch: receiveRecord, // 分页查询api接口
      condition: { },
      cargoNameList: [], //品名
      data: []
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.loadData()
    })
    //获取品名
    getCargoNameList().then(res => {
      this.cargoNameList = res.data.aaData
    })
  },
  methods: {
    clearForm() {
      return {}
    },
    loadData() {
      this.$refs.baselist.loadData()
    },
    //重置
    resuleBtn(aList) {
      this.$refs[aList].resetFields()
      this.condition = this.clearForm()
    }
  }
}
</script>
<style scoped>
